package com.bdweb.service.impl;
import com.bdweb.dao.powerDao;
import com.bdweb.dao.weakDao;


import com.bdweb.model.WEAK;
import com.bdweb.service.WeakService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WeakServiceImpl implements WeakService {
    @Autowired
    private weakDao weakDao;


    @Override
    public List<WEAK> findAllWeak() {
        return weakDao.findAll();
    }

    @Override
    public WEAK findWeak(Integer id, String mediaName, String ip, String port, boolean isopen, String title, String opencode, String closecode) {
        return weakDao.findByNameAndPwd(id,mediaName,ip,port,isopen,title,opencode,closecode);
    }

    @Override
    public Integer addWeak(WEAK weak) {
        return weakDao.addByPower(weak);
    }

    @Override
    public Integer deleteWeak(Integer id) {
        return weakDao.deleteWeakById(id);
    }

    @Override
    public Integer updateWeak(Integer id, String mediaName, String ip, String port, boolean isopen, String title, String opencode, String closecode) {
        return weakDao.updateNameAndPwdById(id,mediaName,ip,port,isopen,title,opencode,closecode);
    }
}
